<?php
// we connect to example.com and port 3307
$link = mysql_connect('localhost', 'root', '123456');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';

echo "<br>";

mysql_select_db("mydb") or die(mysql_error());
echo "Connected to Database";

mysql_close($link);
?>